package com.hehe.service;

import com.hehe.entity.User;
import com.hehe.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService{
    @Autowired
    private UserMapper userMapper;

    public int add(User user) {

            return userMapper.add(user);

    }

    public int del(User user) {
        return 0;
    }

    public int del(int userid) {
        return userMapper.del(userid);

    }

    public int update(User user) {
        return  userMapper.update(user);
    }

    public int update_nickname(User user) {
        return userMapper.update_nickname(user);
    }

    public int update_headpic(User user) {
        return userMapper.update_headpic(user);
    }

    public int updata_status(int userid, int status) {
        return userMapper.updata_status(userid,status);
    }

    public int update_credit(int userid,int status) {
        return userMapper.update_credit( userid, status);
    }

    public User findOneById(int Id) {
        User user = userMapper.findOneById(Id);
        return user;
    }

    public User findOneByname(String name) {
        User user = userMapper.findOneByname(name);
        return user;
    }

    public List<User> findAll() {
        return userMapper.findAll();
    }


}
